{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}

{% block title %}HotNews{% endblock %}

{% block page_content %}

<div class="container m-cover">
    <div class="center">
        <ul class="pagination">
            {% if hasPrev %}
                <li><a href="/time/{{prevNum}}">&laquo;</a></li>
            {% endif %}
            {% for i in range(1, pages)%}
                {% if i == page %}
                    <li class="active"><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i == 1 or i == pages - 1 %}
                    <li><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i > page - 8 and i < page + 8 %}
                    <li><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i == page -8 or i == page + 8 %}
                    <li><a href="#">...</a></li>
                {% endif %}
            {% endfor %}
            {% if hasNext %}
                <li><a href="/time/{{nextNum}}">&raquo;</a></li>
            {% endif %}
        </ul>
    </div>
    <div class="row">
        <div class="col-md-12">
            {% for k, vs in timesDict.items() %}
                <ul class="list-group">
                    <h3 class="list-group-item m-list-header" >{{k}}</h3>
                    {% for v in vs %}
                    <a class="list-group-item" href="{{v['path']}}">
                        <span class="badge">
                            <h7>{{v['type']}}</h7>
                        </span>
                        <h4 class="list-group-item-heading">
                            {{v['title']}}
                        </h4>
                    </a>
                    {% endfor%}
                </ul>
            {% endfor %}
        </div>
    </div>

    <div class="page-header">
        <ul class="pagination">
            {% if hasPrev %}
                <li><a href="/time/{{prevNum}}">&laquo;</a></li>
            {% endif %}
            {% for i in range(1, pages)%}
                {% if i == page %}
                    <li class="active"><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i == 1 or i == pages - 1 %}
                    <li><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i > page - 8 and i < page + 8 %}
                    <li><a href="/time/{{i}}">{{i}}</a></li>
                {% elif i == page -8 or i == page + 8 %}
                    <li><a href="#">...</a></li>
                {% endif %}
            {% endfor %}
            {% if hasNext %}
                <li><a href="/time/{{nextNum}}">&raquo;</a></li>
            {% endif %}
        </ul>
    </div>
</div>
{% endblock %}